<template>
  <div class="tree-container">
    <el-tree :data="props.data" :props="{ key: 'deptId', label: 'deptName' }" @node-click="handleTreeSelect" />
  </div>
</template>

<script setup>
const props = defineProps({
  data: {
    type: Array,
    default: () => [],
  },
});

const emits = defineEmits(['nodeClick']);

const handleTreeSelect = (selectDept) => {
  const deptid = selectDept.deptId;
  console.log("selectedKeys:",deptid)
  emits('nodeClick', { deptId: `/${deptid}/` });
}
</script>

<style lang="scss">
.tree-container {
  padding-right: 20px;
}
</style>
